﻿<?xml version="1.0" encoding="utf-8"?>

<!--
  specific discriminator values in all hierarchy
-->

<Mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Entity type="NUnit:OptimizedInferredRelationships:Domain:Person" table="Person" discriminator-field="type" discriminator-value="person">
    
    <Id field="PersonId">
      <Generator name="guid" />
    </Id>

    <Attribute name="FirstName" field="firstname" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="LastName" field="lastname" db-type="String" size="50" scale="0" precision="0" not-null="false" />

    <Reference name="Address" entityChild="NUnit:OptimizedInferredRelationships:Domain:Address">
      <Rule parentField="PersonId" childTable="Address" childField="FK_Address" />
    </Reference>

    <Reference name="Vehicule" entityChild="NUnit:OptimizedInferredRelationships:Domain:Vehicule">
      <Rule parentField="PersonId" childTable="Vehicule" childField="FK_Vehicule" />
    </Reference>

  </Entity>

  <Entity type="NUnit:OptimizedInferredRelationships:Domain:Address" table="Address">
    
    <Id field="AddressId">
      <Generator name="guid" />
    </Id>
    
    <Attribute name="City" field="city" db-type="String" size="50" scale="0" precision="0" not-null="false" />

  </Entity>

  <Entity type="NUnit:OptimizedInferredRelationships:Domain:Vehicule" table="Vehicule" >

    <Id field="Id">
      <Generator name="guid" />
    </Id>

    <Reference name="Passengers" entityChild="NUnit:OptimizedInferredRelationships:Domain:Passenger">
      <Rule parentField="Id" childTable="Passenger" childField="FK_VehiculeId" />
    </Reference>

  </Entity>

  <Entity type="NUnit:OptimizedInferredRelationships:Domain:Passenger" table="Passenger" >

    <Id field="PassengerId">
      <Generator name="guid" />
    </Id>

    <Attribute name="Name" field="Name" db-type="String" size="36" scale="0" precision="0" not-null="false" />

  </Entity>
</Mapping>